/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package poker.game;

import java.util.Iterator;
import java.util.List;

/**
 * The function for Texas hold em minimax
 * 
 * @author Benjamin L. Brodie <blbrodie@gmail.com>
 */
public class TexasMinimaxFunction implements MinimaxEvaluationFunction{
    //Weights x <encoding> + weights x <pocket pair, suited, etc> + weights x chips bet + weights x chips lost/won overall + weights x + difference encoding
    List<Double> weights;
    
    public TexasMinimaxFunction(List<Double> weights){
       this.weights = weights;
      
    }
    
    @Override
    public double evaluate(List<Integer> parameters){
        if (parameters.size() != weights.size()){
            throw new IllegalArgumentException("weights and parameters vector must be same size");
        }
        
        Iterator<Double> weightsIter = weights.iterator();
        Iterator<Integer> paramsIter = parameters.iterator();
        
        double total = 0;
        while (weightsIter.hasNext()){
            total += weightsIter.next() * paramsIter.next();
        }
        
        return total;
    }
}
